package com.shuda.business.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shuda.business.user.entity.RolePermissionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 角色权限关联Mapper接口
 */
@Mapper
public interface RolePermissionMapper extends BaseMapper<RolePermissionEntity> {

    /**
     * 根据角色ID查询权限ID列表
     */
    List<Long> selectPermissionIdsByRoleIds(@Param("roleIds") List<Long> roleIds);

    /**
     * 根据角色ID删除所有权限关联
     */
    int deleteByRoleId(@Param("roleId") Long roleId);

    /**
     * 批量插入角色权限关联
     */
    int batchInsert(@Param("rolePermissions") List<RolePermissionEntity> rolePermissions);

    /**
     * 根据权限ID查询菜单ID列表
     */
    List<Long> selectMenuIdsByPermissionIds(@Param("permissionIds") List<Long> permissionIds);
}